﻿(function () {
    var FallingLine = function (centerX, centerY, color, lineLength) {
        Class.super(tetris._FallingObject, this, arguments);

        lineLength = lineLength || 4;

        this.center.x = centerX;
        this.center.y = centerY;

        this._relativeBody.push(new tetris.Block(0, 0, color));
        for (var i = 1; i < lineLength; i++)
        {
            if (i % 2 == 0) {
                this._relativeBody.push(new tetris.Block(parseInt((i + 1) / 2), 0, color));
            }
            else {
                this._relativeBody.push(new tetris.Block(parseInt(-(i + 1) / 2), 0, color));
            }
        }

        for (var j = 0; j < this._relativeBody.length; j++) {
            this.getBody.push(new tetris.Block(0, 0, color));
        }
        this._recalculateBody();
    };
    FallingLine.inherit(tetris._FallingObject);

    tetris.FallingLine = FallingLine;
})();